// 异步 如果有dispatch就先执行中间件 yarn add redux-thunk

import { getChannels } from "@/api"
export const actionUser = () => {
  // 返回一个function函数
  return async (dispatch) => {
    const res = await getChannels()
    // 先拿到后端请求 再派发reducer
    dispatch({
      type: "USER",
      payload: { id: res.message }
    })
  }
}